import request from '@/utils/request'
/**
 * 商品分类
 * @param {*} params 
 */
// 商品类别
export function categoryPageVoByQo(params) {
  return request({
    url: '/dinner/category/pageVoByQo',
    method: 'post',
    params
  })
}

// 商品类别批量删除
export function categoryRemoveByIds(params) {
  return request({
    url: '/dinner/category/removeByIds',
    method: 'post',
    params
  })
}

// 商品类别添加,商品类别修改(type有值为修改)
export function categorySave(params, type) {
  return request({
    url: type ? '/dinner/category/update' : '/dinner/category/save',
    method: 'post',
    params
  })
}

/**
 * 商品管理
 * @param {*} params 
 */
// 分页查询
export function productPageByQo(params) {
  return request({
    url: '/dinner/product/pageByQo',
    method: 'post',
    params
  })
}

//秒杀 分页查询
export function secKillProductPageByQo(params) {
  return request({
    url: '/dinner/product/seckill/pageByQo',
    method: 'post',
    params
  })
}

//经销商品 分页查询
export function agentProductPageByQo(params) {
  return request({
    url: '/dinner/product/proxy/pageByQo',
    method: 'post',
    params
  })
}

//活动专区 分页查询
export function activityProductPageByQo(params) {
  return request({
    url: '/dinner/product/activity/pageByQo',
    method: 'post',
    params
  })
}

// 批量删除
export function productRemoveByIds(params) {
  return request({
    url: '/dinner/product/removeByIds',
    method: 'post',
    params
  })
}

// 批量上架或下架
export function productFrozen(params) {
  return request({
    url: '/dinner/product/frozen',
    method: 'post',
    params
  })
}

// 添加、修改(type有值为修改)
export function productSave(data, type) {
  return request({
    url: type ? '/dinner/product/update' : '/dinner/product/save',
    method: 'post',
    data
  })
}

//秒杀商品 添加、修改(type有值为修改)
export function secKillProductSave(data, type) {
  return request({
    url: type ? '/dinner/product/seckill/update' : '/dinner/product/seckill/save',
    method: 'post',
    data
  })
}

//经销商品 添加、修改(type有值为修改)
export function agentProductSave(data, type) {
  return request({
    url: type ? '/dinner/product/proxy/update' : '/dinner/product/proxy/save',
    method: 'post',
    data
  })
}

//活动专区商品 添加、修改(type有值为修改)
export function activityProductSave(data, type) {
  return request({
    url: type ? '/dinner/product/activity/update' : '/dinner/product/activity/save',
    method: 'post',
    data
  })
}

// 商品单个查询（详情）
export function productGetById(params) {
  return request({
    url: '/dinner/product/getById',
    method: 'post',
    params
  })
}

// 复制到商品到小程序
export function copyToC(params) {
  return request({
    url: '/dinner/product/copyToC',
    method: 'post',
    params
  })
}

export function getAgentDetailList(params) {
  return request({
    url: '/dinner/proxy/find',
    method: 'post',
    params,
  })
}

export function getZcyxAgentDetailList(params) {
  return request({
    url: '/dinner/proxy/page',
    method: 'post',
    params,
  })
}

export function saveAgentDetail(params) {
  return request({
    url: '/dinner/proxy/save',
    method: 'post',
    params,
  })
}

export function updateAgentDetail(params) {
  return request({
    url: '/dinner/proxy/update',
    method: 'post',
    params,
  })
}

export function deleteAgentDetail(params) {
  return request({
    url: '/dinner/proxy/delete',
    method: 'post',
    params,
  })
}

// 商品分润表查找
export function productSplitPageByQo(params) {
  return request({
    url: "/dinner/product/split/pageByQo",
    method: "post",
    params
  });
}

// 商品分润表添加
export function productSplitSave(params) {
  return request({
    url: "/dinner/product/split/save",
    method: "post",
    params
  });
}

// 商品分润表编辑
export function productSplitUpdate(params) {
  return request({
    url: "/dinner/product/split/update",
    method: "post",
    params
  });
}


// 商品分润表删除
export function productSplitRemoveByIds(params) {
  return request({
    url: "/dinner/product/split/removeByIds",
    method: "post",
    params
  });
}

//众茶优选积分商品 分页查询
// export function scoreProductPageByQo(params) {
//   return request({
//     url: '/dinner/product/score/pageByQo',
//     method: 'post',
//     params
//   })
// }

//众茶优选积分商品 添加、修改
// export function scoreProductSave(data) {
//   return request({
//     url: '/dinner/product/score/saveOrUpdate',
//     method: 'post',
//     data
//   })
// }

// 众茶优选积分商品单个查询（详情）
// export function scoreProductGetById(params) {
//   return request({
//     url: '/dinner/product/score/getById',
//     method: 'post',
//     params
//   })
// }

// 众茶优选积分商品批量上架或下架
// export function scoreProductFrozen(params) {
//   return request({
//     url: '/dinner/product/score/upOrDown',
//     method: 'post',
//     params
//   })
// }

// 众茶优选积分商品批量删除
// export function scoreProductRemoveByIds(params) {
//   return request({
//     url: '/dinner/product/score/remove',
//     method: 'post',
//     params
//   })
// }

export function getProxyBrandList(params) {
  return request({
    url: '/dinner/proxy/brand/query',
    method: 'post',
    params,
  })
}

export function updateProxyBrand(data) {
  return request({
    url: '/dinner/proxy/brand/saveOrUpdate',
    method: 'post',
    data,
  })
}

export function removeProxyBrand(params) {
  return request({
    url: '/dinner/proxy/brand/remove',
    method: 'post',
    params,
  })
}

export function getAdList(params) {
  return request({
    url: '/dinner/ad/query',
    method: 'post',
    params,
  })
}

export function updateAd(data) {
  return request({
    url: '/dinner/ad/saveOrUpdate',
    method: 'post',
    data,
  })
}

export function removeAd(params) {
  return request({
    url: '/dinner/ad/remove',
    method: 'post',
    params,
  })
}

export function splitRecordPage(params) {
  return request({
    url: '/dinner/product/split/record/pageByQo',
    method: 'post',
    params,
  })
}

export function saveSplitRecord(params) {
  return request({
    url: '/dinner/product/split/record/save',
    method: 'post',
    params,
  })
}


export function updateSplitRecord(params) {
  return request({
    url: '/dinner/product/split/record/update',
    method: 'post',
    params,
  })
}

export function removeSplitRecord(params) {
  return request({
    url: '/dinner/product/split/record/removeByIds',
    method: 'post',
    params,
  })
}
